from flask_cors import CORS

from apps.blue import init_blueprint
from apps.db import db
from apps.schedule.logger_package import ScheduleThread

schedule_thread = None


def init_ext(app):
    db.init_app(app)
    cors = CORS()
    cors.init_app(app, supports_credentials=True)
    init_blueprint(app)
    # 日志打包进程
    global schedule_thread
    if schedule_thread is None:
        schedule_thread = ScheduleThread()
        schedule_thread.start()
